<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('请假详情')" />
	<th:block th:include="include :: jsonview-css" />
	<th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
	<form class="form-horizontal m-t" id="signupForm">
		<input class="form-control" type="hidden"  name="businessKey" th:value="${sysOaLeave.leaveNo}"/>
		<h4 class="form-header h4">请假信息</h4>
		<div class="form-group">
			<label class="col-sm-3 control-label">单号：</label>
			<div class="form-control-static"  th:text="${sysOaLeave.leaveNo}">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">标题：</label>
			<div class="form-control-static" th:text="${sysOaLeave.name}">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">请假理由：</label>
			<div class="form-control-static"><pre id="reason"></pre></div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">开始时间：</label>
			<div class="form-control-static" th:text="${#dates.format(sysOaLeave.startTime, 'yyyy-MM-dd hh:mm:ss')}">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">结束时间：</label>
			<div class="form-control-static" th:text="${#dates.format(sysOaLeave.endTime, 'yyyy-MM-dd HH:mm:ss')}">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">申请人：</label>
			<div class="form-control-static" th:text="${sysOaLeave.applyPerson}">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">附件：</label>
			<div class="col-sm-8">
				<input type="hidden" name="fileUrl" id="fileKey" th:value="${sysOaLeave.fileUrl}">
				<div class="form-control-static">
					<a   id="fileName"></a>
					<a  th:onclick="preview(${appFrom.fileUrl})">预览</a>
				</div>
			</div>
		</div>
	</form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: jsonview-js" />
	<th:block th:include="include :: bootstrap-fileinput-js"/>
    <script th:inline="javascript">
	    $(function() {
	    	var reason = [[${sysOaLeave.reason}]];
	    	if ($.common.isNotEmpty(reason) && reason.length < 2000) {
                $("#reason").text(reason);
	    	} else {
	    		$("#reason").text(reason);
	    	}
			var filekey= $("#fileKey").val();
			var data= $.common.getFileByKey();
			$('#fileName').attr('href',"../../../common/download?fileKey="+filekey);
			$("#fileName").text(data.name);
	    });
		function preview(url) {
			window.open('http://47.98.36.102:8012/onlinePreview?url='+encodeURIComponent(Base64.encode(url)));
		}

        $(".file-upload").each(function (i) {
            var val = $("input[name='" + this.id + "']").val();
            $(this).fileinput({
                'uploadUrl': '/common/upload',
                initialPreviewAsData: true,
                initialPreview: [val],
                maxFileCount: 1,
                autoReplace: true
            }).on('fileuploaded', function (event, data, previewId, index) {
                $("input[name='" + event.currentTarget.id + "']").val(data.response.url)
            }).on('fileremoved', function (event, id, index) {
                $("input[name='" + event.currentTarget.id + "']").val('')
            })
            $(this).fileinput('_initFileActions');
        });

    </script>
</body>
</html>